<?php if (in_array($this->studentSn, array_keys($this->studentData))):?>
<script>
$(function(){
$("#setForm").ajaxForm();
$(".score, .description").focus(function(){
    $(".score, .description").removeClass('focus');
    $(this).addClass('focus');
    var x = $(this).offset().top - 100; // 100 provides buffer in viewport
    $('html,body').animate({scrollTop: x}, 50);
   });
});
</script>

<form action="<?php echo $this->route('set-student')?>" method="post" id="setForm">

<table class="ui-corner-all" style="border:#ccc solid thin; background:#ccc;margin:5px;padding:5px">
<thead>
<tr>
<th><?php echo $this->translate('subject name')?></th>
<th><?php echo $this->translate('semester score')?></th>
<th><?php echo $this->translate('score description')?></th>
</tr>
</thead>
<tbody>
<?php $i =0 ;?>
<?php foreach ($this->subjectData as $subjectSn=>$val):?>
<tr>
<td><?php echo $val['name']?></td>
<td>
<input type="text"  class="score" name="score[<?php echo $subjectSn?>]?>" size="5"  tabindex="<?php echo 100+$i?>"
value="<?php if (isset($this->scoreData[$subjectSn]['score']))echo $this->scoreData[$subjectSn]['score']?>" />
</td>
<td>
<input type="text"  class="description" name="description[<?php echo $subjectSn?>]?>" size="40"  tabindex="<?php echo 200+$i?>"
value="<?php if (isset($this->scoreData[$subjectSn]['description']))echo $this->scoreData[$subjectSn]['description']?>" />
</td>
</tr>
<?php $i++?>
<?php endforeach?>
</tbody>

</table>
<input type="hidden" name="studentSn" />
</form>
<?php endif?>